import frida
import sys

rdev = frida.get_remote_device()
session = rdev.attach("得物")

scr = """
Java.perform(function () {
    var RequestUtils = Java.use("com.shizhuang.duapp.common.utils.RequestUtils");
    RequestUtils.c.implementation = function(map,j2){
        console.log("-----------------Hook来了-----------------------");
        
        console.log("参数map=",map);       
        console.log("参数j2=",j2);       
        console.log("参数map类型=",JSON.stringify(map)); 
              
        var Map = Java.use('java.util.HashMap');
        var obj = Java.cast(map, Map);
        console.log('1.参数字典为：',obj.toString());
        
        var res = this.c(map,j2);
        console.log("4.newSign结果：", res);
        return res;
    }
    
    var AESEncrypt = Java.use("com.duapp.aesjni.AESEncrypt");
        AESEncrypt.encode.implementation = function(str){
        console.log('2.调用so参数：',str);
        var res = this.encode(str);
        console.log('3.调用so返回：',res);
        return res;
    }
});
"""
script = session.create_script(scr)

def on_message(message, data):
    print(message, data)


script.on("message", on_message)

script.load()
sys.stdin.read()
